package com.quick.im.client.abstracts;

import com.quick.im.client.interfaces.MessageStrategy;
import com.quick.im.common.entity.message.MessageInfo;
import jakarta.websocket.Session;

public abstract class AbsMessageStrategy implements MessageStrategy {

    @Override
    public void onMessage(MessageInfo messageInfo, Session session) throws Exception {
        sendMessageBefore(messageInfo,session);
        sendMessage(messageInfo,session);
        sendMessageAfter(messageInfo,session);
    }
    protected abstract void sendMessage(MessageInfo messageInfo, Session session) throws Exception;

    protected abstract void sendMessageBefore(MessageInfo messageInfo, Session session) throws Exception;

    protected abstract void sendMessageAfter(MessageInfo messageInfo, Session session);

}
